# 指定架构
ARCH := arm64

# 指定内核源码路径
KERNEL_DIR := /home/alientek/rk3588_linux_sdk/kernel

# 驱动名称
obj-m := devChrled.o

# 当前目录
PWD := $(shell pwd)

# 默认目标
all: kernel_modules

# 编译模块
kernel_modules:
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules

# 清理
clean:
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) clean

# 帮助信息
help:
	@echo "Usage:"
	@echo "  make                    - 编译驱动模块"
	@echo "  make clean             - 清理编译文件"